package week06;

public abstract class AbstractPersonCmp {
    public abstract int compare(Person p1, Person p2);

    public void sort(Person[] personArray) {
        for( int i=0; i<personArray.length-1; i++ ) {
            for (int j = i + 1; j < personArray.length; j++) {
                if (compare(personArray[i], personArray[j]) < 0) {
                    Person tmp = personArray[i];
                    personArray[i] = personArray[j];
                    personArray[j] = tmp;
                }
            }
        }
    }

}